package com.zbj.validator.entity;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.zbj.validator.common.BaseRequest;
import com.zbj.validator.util.Constant;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

/**
 * Student
 *
 * @author weigang
 * @create 2017-04-23
 **/
public class Student extends BaseRequest implements Serializable {

	private static final long serialVersionUID = -4595588239902593077L;

	/**
	 * 学生ID
	 */
	private int id;

	/**
	 * 学生名字
	 */
	@NotEmpty(message = "名字不能为空")
	@Size(min = 3, max = 20, message = "名字长度在3-20之间")
	private String name;

	/**
	 * 学生年龄
	 */
	@NotNull(message = "年龄不能为空")
	@Min(value = 18, message = "年龄最小为18")
	@Max(value = 120, message = "年龄最大为120")
	private int age;

	/**
	 * 学生地址
	 */
	@NotEmpty(message = "地址不能为空")
	private List<String> addressList = Lists.newArrayList();

	/**
	 * 学生联系方式
	 */
	@NotEmpty(message = "手机号不能为空")
	@Pattern(regexp = Constant.PHONE_MAINLAND_REGEX, message = "手机号格式不正确")
	private String phone;

	/**
	 * 学生邮件地址
	 */
	@NotEmpty(message = "邮件地址不能为空")
	@Email
	private String email;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public List<String> getAddressList() {
		return addressList;
	}

	public void setAddressList(List<String> addressList) {
		this.addressList = addressList;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}
}
